package com.petadoption.serverclient.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.petadoption.serverclient.entity.Deliver;
import com.petadoption.serverclient.mapper.DeliverMapper;
import com.petadoption.serverclient.service.IDeliverService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 汪仕杰
 * @since 2023-08-28
 */
@Service
public class DeliverServiceImpl extends ServiceImpl<DeliverMapper, Deliver> implements IDeliverService {
    @Resource
    private DeliverMapper deliverMapper;


    @Override
    public Deliver findDeliverByPetId(Integer petId) {
        QueryWrapper<Deliver> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("deliver_pet", petId);
        return deliverMapper.selectOne(queryWrapper);
    }

    @Override
    public int addDeliver(Deliver deliver) {
        return deliverMapper.insert(deliver);
    }
}
